perl-script vs cgi-script

perl-script vs cgi-script

am 02.08.2010 03:21:20 von Roland Mai

--0016364d22e5a5a5c6048ccd0480
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I'm relatively new to perl so bear with me please. I'm seeing a strange
behavior with perl

When I use the following config in apache


ServerName perly
DocumentRoot /var/www/perl/perly


AddHandler perl-script .pl
PerlOptions ParseHeaders
PerlHandler ModPerl::Registry
PerlSendHeader On
Options Indexes ExecCGI
AllowOverride All
Order allow,deny
Allow from All



The following code
#!/usr/bin/perl -w
use strict;
use warnings;
use DBI;
use Cwd;
use CGI::Pretty qw(:standard);

my %config = (
host => 'localhost',
database => 'perly',
username => 'root',
password => ''
);

my $dbh = DBI->connect("dbi:mysql:".$config{'database'},
$config{'username'}, $config{'password'});

print header,
start_html(-title => 'Please Login',
-base => 'true',
-target => '_blank',
-meta => {'keywords' => 'login',
'description' => 'This is the login screen'},
-style => {'src'=>'/styles/style1.css'} );
require("/var/www/perl/perly/login.pl");
print end_html;
print "\n";

The login.pl file gets executed only once. Upon subsequent refreshes it
dissapears.
If I have AddHandler cgi-script .pl above, the script works fine.

Can someone please help me fix this issue?

Thanks,

Roland

--0016364d22e5a5a5c6048ccd0480
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

I'm relatively new to perl so bear with me please. I'm s=
eeing a strange behavior with perl

When I use the following config i=
n apache

<VirtualHost *:80>
=A0 ServerName perly
=A0 Doc=
umentRoot /var/www/perl/perly


=A0 <Directory /var/www/perl/perly>
  =A0 AddHandler perl-=
script .pl
  =A0 PerlOptions ParseHeaders
  =A0 PerlHandler M=
odPerl::Registry
  =A0 PerlSendHeader On
  =A0 Options Index=
es ExecCGI
  =A0 AllowOverride All

  =A0 Order allow,deny
  =A0 Allow from All
=A0 </Director=
y>
</VirtualHost>

The following code
#!/usr/bin/perl =
-w
use strict;
use warnings;
use DBI;
use Cwd;
use CGI::Pret=
ty qw(:standard);


my %config =3D (
  =A0 host     =3D> 'localhost&#=
39;,
  =A0 database =3D> 'perly',
  =A0 username =
=3D> 'root',
  =A0 password =3D> ''
);
<=
br>my $dbh =3D DBI->connect("dbi:mysql:".$config{'database=
'}, $config{'username'}, $config{'password'});


print header,
start_html(-title   =3D>=A0 'Please Login&#=
39;,
          =A0 -base   =3D>=A0 'true&=
#39;,
          =A0 -target =3D>=A0 '_blank&#=
39;,
          =A0 -meta   =3D>=A0 {'keyw=
ords'     =3D>=A0 'login',

                          &#=
39;description'=A0 =3D>=A0 'This is the login screen'},
=
          =A0 -style=A0 =3D>=A0 {'src'=3D>=
;'/styles/style1.css'} );
require("/var/www/perl/perly/ ref=3D"http://login.pl">login.pl");

print end_html;
print "\n";

The ..pl">login.pl file gets executed only once. Upon subsequent refreshes i=
t dissapears.
If I have AddHandler cgi-script .pl above, the script work=
s fine.


Can someone please help me fix this issue?

Thanks,

Roland=





--0016364d22e5a5a5c6048ccd0480--

Re: perl-script vs cgi-script

am 02.08.2010 03:49:54 von merlyn

>>>>> "Roland" == Roland Mai writes:

Roland> The login.pl file gets executed only once. Upon subsequent refreshes it
Roland> dissapears.

What does that mean? Does it generate content? Are there any errors in
the error log? Can you log that it is being actually invoked?

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095

Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

Re: perl-script vs cgi-script

am 02.08.2010 03:53:47 von Roland Mai

--0016e6d7e8ffb40b34048ccd780f
Content-Type: text/plain; charset=ISO-8859-1

Well, Anthony Esposito replied to me personally explaining that the files
get compiled once, I suppose to speed things up. So, the login.pl gets
rendered only once (when it's compiled), but not thereafter. The solution is
to turn the stuff in login.pl into a method and invoke it later.

On Sun, Aug 1, 2010 at 9:49 PM, Randal L. Schwartz wrote:

> >>>>> "Roland" == Roland Mai writes:
>
> Roland> The login.pl file gets executed only once. Upon subsequent
> refreshes it
> Roland> dissapears.
>
> What does that mean? Does it generate content? Are there any errors in
> the error log? Can you log that it is being actually invoked?
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
>
> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside
> discussion
>

--0016e6d7e8ffb40b34048ccd780f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Well, Anthony Esposito replied to me personally explaining that the files g=
et compiled once, I suppose to speed things up. So, the ogin.pl">login.pl gets rendered only once (when it's compiled), but=
not thereafter. The solution is to turn the stuff in in.pl">login.pl into a method and invoke it later.


On Sun, Aug 1, 2010 at 9:49 PM, Randal L. Sc=
hwartz <merly=
n@stonehenge.com
>
wrote:
style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 2=
04); padding-left: 1ex;">
>>>>> "Roland" == Roland Mai < ilto:roland.mai@gmail.com">roland.mai@gmail.com> writes:



Roland> The f=
ile gets executed only once. Upon subsequent refreshes it

Roland> dissapears.



What does that mean? =A0Does it generate content? =A0Are there any errors i=
n

the error log? =A0Can you log that it is being actually invoked?



--

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095=


<> =
<URL:htt=
p://www.stonehenge.com/merlyn/
>

Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.

See http:/=
/methodsandmessages.vox.com/
for Smalltalk and Seaside discussion





--0016e6d7e8ffb40b34048ccd780f--